<script setup>
defineProps({
  type: {
    type: String,
    required: true,
    validator: (value) => ['success', 'error'].includes(value)
  },
  message: {
    type: String,
    required: true
  },
  show: {
    type: Boolean,
    default: false
  }
});
</script>

<template>
  <transition name="fade">
    <div v-if="show" :class="['alert-message', type]">
      <i :class="type === 'success' ? 'fas fa-check-circle' : 'fas fa-exclamation-circle'"></i>
      {{ message }}
    </div>
  </transition>
</template>

<style scoped>
.alert-message {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  animation: fadeIn 0.3s ease-out forwards;
}

.alert-message.success {
  background-color: #e6f7ef;
  color: #00b07b;
}

.alert-message.error {
  background-color: #feeae9;
  color: #f44336;
}

.alert-message i {
  font-size: 1.2rem;
  margin-right: 10px;
}

.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from, .fade-leave-to {
  opacity: 0;
}
</style> 